import {Globalstyle} from './style'
import {GlobalIconfont} from './statics/iconfont/iconfont'
import {Provider} from "react-redux";
import store from "./store";
import {BrowserRouter, Route} from "react-router-dom";
import Header from './common/header'
import Home from './pages/home'
import Detail from './pages/detail/loadable'
import Login from './pages/login'
import Write from './pages/write'

function App() {
    return (
        //Provider为子组件 提供store,Provider使得子组件可以使用store
        <Provider store={store}>
            <Globalstyle/>
            <GlobalIconfont/>
            {/*BrowserRouter代表的是一个路由，Route代表的是一个路由规则
            */}
            <BrowserRouter>
                <div>
                    <Header/>
                    {/*exact 路径完全匹配*/}
                    {/*<Route path='/' exact render={() => <div>index</div>}></Route>*/}
                    {/*<Route path='/detail' exact render={() => <div>detail</div>}></Route>*/}
                    <Route path='/' exact component={Home}></Route>
                    <Route path='/login' exact component={Login}></Route>
                    <Route path='/write' exact component={Write}></Route>
                    {/*<Route path='/detail' exact component={Detail}></Route>*/}
                    <Route path='/detail/:id' exact component={Detail}></Route>
                </div>
            </BrowserRouter>
        </Provider>
    );
}

export default App;
